1. Field of the Invention
The present invention relates to an alarm sounding apparatus for a computer such as a notebook type or a lap-top personal computer or word processor.
2. Description of the Related Art
Battery-driven computers such as notebook type or lap-top personal computers have a function of sounding an alarm to warn the user that the battery capacity becomes very small or that the display panel is closed while the power source is ON.
As shown in FIG. 11, a voltage detector 2 is connected to a nickel cadmium battery 1 as the power source. The voltage detector 2 turns a signal BATT0 to "H" when the voltage of the nickel cadmium battery 1 drops below a first threshold value, while turning a signal BATT1 to "H" when the voltage of the nickel cadmium battery 1 drops below a second threshold value.
An NMI (Non Maskable Interrupt) generator 3 is connected to the voltage detector 2, and the signals BATT0 and BATT1 are supplied to the NMI generator 3 which generates an NMI signal as the highest priority interrupt signal. A panel switch 4 is connected to the NMI generator 3. To the NMI generator 3 is supplied a signal PANELSW which is turned to "H" when the LCD panel, which also serves as a lid of the main frame, is closed during use.
The NMI generator 3 generates an NMI signal when one of the three signals input thereto is "H", and supplies the NMI signal to a CPU 5. A RAM 6 is connected to the CPU 5. The CPU 5 constantly reads out and executes the program stored in the RAM 6 at ordinary time. On the other hand, when the NMI signal, which is the highest priority interrupt signal, is input to the CPU 5, the CPU 5 executes the processing for sounding an alarm in accordance with the NMI signal. In other words, the CPU 5 calls the NMI routine which is stored at the address specified by the NMI vector address of the RAM 6, and executes the NMI routine so as to generate data for sounding an alarm.
A speaker data generator 7 is connected to the CPU 5. The speaker data generator 7 generates a sounding signal SPKOUT in accordance with various commands for producing a sound, and supplies the sounding signal SPKOUT to a speaker 8. The speaker 8 sounds an alarm in accordance with the sounding signal SPKOUT when the data for sounding an alarm is received from the CPU 5. An alarm is sounded when the battery capacity is reduced to a first threshold value, or to a second threshold value or when the display panel is closed during use. Three different alarms are generally sounded in correspondence with these three states.
In this way, an alarm is sounded when the CPU 5 executes the NMI routine which is stored in the RAM 6.
The NMI routine is written at a predetermined address of the RAM 6 when the power source is turned on. However, some application programs executed by a computer greatly change the contents of RAM 6, so that a different program is sometimes written at the same address that the NMI routine is written. In such cases, when the NMI signal is generated by the NMI generator 3, the CPU 5 executes not the NMI routine but the application program stored at the address which is specified by the NMI vector address. Since not the NMI routine but an unexpected program is executed, there is a possibility of the runaway of the computer.